package com.skf.mokao.test.fetcher.fetcher;

import java.sql.Connection;
import java.sql.DriverManager;

import com.sun.tools.apt.Main;


public class DbUtil {
	public Connection getCon() throws Exception{
		Class.forName("com.mysql.jdbc.Driver");
		Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/db_shiro?useSSL=true&serverTimezone=UTC", "root","123");
		return con;
	}
	
	public void closeCon(Connection con) throws Exception{
		if(con!=null) {
			con.close();
		}
	}
	
	public static void main(String[] arg) {
		DbUtil dbUtil = new DbUtil();
		try {
			dbUtil.getCon();
			System.out.println("连接成功！");
		} catch (Exception e) {
			// TODO Auto-generated catch block
			System.out.println("连接失败！");
			e.printStackTrace();
		}
	}
}
